﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Chat.Client
{
    /// <summary>
    /// The chat text message sent by specific chat client.
    /// </summary>
    [Serializable]
    public class MessageCmd : ClientCmd
    {
        /// <summary>
        /// The chat client to send the message to. May specify either
        /// particular single client, or a broadcast message to all the
        /// chat clients. In the latter case the special constant NickName.Broadcast
        /// should be used.
        /// </summary>
        private NickName SendTo { get; set; }
        /// <summary>
        /// The message text.
        /// </summary>
        private string Message { get; set; }

        public MessageCmd(MessageData msgData) : base(msgData.Sender)
        {
            SendTo = msgData.To;
            Message = msgData.Message;
        }

        /// <summary>
        /// Gets the message data, describing the message.
        /// </summary>
        public MessageData MessageData
        {
            get
            {
                return new MessageData(SendTo, Message, Sender);
            }
        }
    }
}
